package com.j.lemon.learn.basic;

/**
 * @Author lijunjun
 * @Date 2019-04-16 14:13
 * @Description  局部变量，成员变量（类变量、实例变量）
 *                 栈              方法区   堆
 *
 *              此题画图分析，一步一步
 */
public class Variable {
    int i;
    int j;
    static int s;

    {
        int i = 1;
        i++;
        j++;
        s++;
    }
    public void test(int j ){
        j++;
        i++;
        s++;
    }

    public static void main(String[] args) {
        Variable v1 = new Variable();
        Variable v2 = new Variable();
        v1.test(10);
        v1.test(20);
        v2.test(30);
        System.out.println(v1.i);
        System.out.println(v1.j);
        System.out.println(v1.s);

        System.out.println(v2.i);
        System.out.println(v2.j);
        System.out.println(v2.s);
    }
}
